import './WebTheme.scss'

import { useState } from 'react'
import { useMount } from 'ahooks'

import { GetIndexedDB } from '../../Utils/IndexedDB'

import { A01, A02 } from '../../Admin/Home/Common'

const HomeTempList = { A01, A02 }


const WebTheme = () => {
    const [Theme, setTheme] = useState()
    useMount(async () => {
        const theme = await GetIndexedDB('theme')
        setTheme(theme)
    })

    if (Theme) {
        const { ThemeSet } = Theme
        const { theme } = ThemeSet
        const Home = HomeTempList[theme]
        return (
            <div className='WebTheme'>
                <div className='WebTheme__Preview Box_Shadow__A01'>
                    <Home ThemeSet={ThemeSet} />
                </div>
            </div>
        )
    }
};

export default WebTheme;